﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using KetBanBonPhuong;

public partial class UserControls_Avatar : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int UserID;
        int GroupID;

        if (Session["UserID"] != null)
        {
            UserID = Convert.ToInt32(Session["UserID"].ToString());
            if (Request.QueryString["GroupID"] != null)
            {
                GroupID = Convert.ToInt32(Request.QueryString["GroupID"].ToString());
                // kiem tra group co phai cua user do hay ko
                DataTable dtGroup = Group.GetGroupByMemberID(UserID);
                foreach (DataRow row in dtGroup.Rows)
                {
                    if (GroupID == Convert.ToInt32(row["group_id"].ToString()))
                    {
                        groupManagePanel.Visible = true;
                        userInfoPanel.Visible = false;
                    }
                }
            }
            else
            {
                groupManagePanel.Visible = false;
                userInfoPanel.Visible = true;
            }
        }        
    }
}
